package com.kkb.kkbcommon.log;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @Author: zml
 * @Description: 用来打印日志的工具类
 * @Data Created in 2021-08-05 19:55
 * @Modified by:
 */
public class LogUtil {
    /**
     * @Author: zml
     * @Description: 获取日志对象
     * @Data Created in 2021-08-05 20:23:50
     * @Modified by:
     */
    private static Logger logger = LoggerFactory.getLogger(LogUtil.class);

    /**
     * @Author: zml
     * @Description: 传入提示打印debug日志
     * @Data Created in 2021-08-05 20:24:18
     * @Modified by:
     *
     * @param msg 要打印的提示
     */
    public static void debug(String msg){
        String className = Thread.currentThread().getStackTrace()[2].getClassName();
        String methodName = Thread.currentThread().getStackTrace()[2].getMethodName();
        int lineNumber = Thread.currentThread().getStackTrace()[2].getLineNumber();

        String stringBuilder = "className: " +
                className +
                ", methodName: " +
                methodName +
                ", lineNumber: " +
                lineNumber +
                " - > " +
                msg;
        logger.debug(stringBuilder);
    }
}
